package com.huawei.appgallery.forum.message.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.huawei.appgallery.forum.base.card.ForumCard;
import com.huawei.appgallery.forum.base.card.bean.PostTime;
import com.huawei.appgallery.forum.base.card.bean.Section;
import com.huawei.appgallery.forum.message.bean.ForumRemindGameMsgCardBean;
import com.huawei.appgallery.forum.section.api.ISectionDetailActivityProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import huawei.widget.HwButton;
import huawei.widget.HwTextView;
import java.util.Locale;
import o.azb;
import o.bqx;
import o.bqy;
import o.brd;
import o.btc;
import o.bue;
import o.bvj;
import o.bvj.b;
import o.bvj.j;
import o.bwx;
import o.bwy;
import o.cgz;
import o.cil;
import o.cim.a;
import o.CollectCheck;
import o.eqx;
import o.evk;
import o.evx;
import o.fho;
import o.fiu;
import o.fjb;
import o.fjo;
import o.fjq;

public class ForumRemindGameMsgCard extends ForumCard implements OnClickListener {
    private ImageView ʻ;
    private HwTextView ʼ;
    private String ʽ;
    private HwTextView ˊ;
    private int ˊॱ = 0;
    private HwTextView ˋ;
    private HwTextView ˎ;
    private ImageView ˏ;
    private Section ˏॱ;
    private ViewStub ͺ;
    private HwButton ॱ;
    private evx ॱˊ = new d(this);
    private View ॱॱ;
    private String ᐝ;

    static final class d extends evx {
        private OnClickListener ˎ;

        d(OnClickListener onClickListener) {
            this.ˎ = onClickListener;
        }

        public void ˋ(View view) {
            this.ˎ.onClick(view);
        }
    }

    public ForumRemindGameMsgCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        this.ˏ = (ImageView) view.findViewById(b.ʽˋ);
        this.ˎ = (HwTextView) view.findViewById(b.ʽᐝ);
        this.ˊ = (HwTextView) view.findViewById(b.ﾞ);
        this.ॱ = (HwButton) view.findViewById(b.ˌ);
        this.ˋ = (HwTextView) view.findViewById(b.ˑ);
        this.ʼ = (HwTextView) view.findViewById(b.ˎˎ);
        this.ͺ = (ViewStub) view.findViewById(b.ˏˎ);
        LinearLayout linearLayout = (LinearLayout) view.findViewById(b.ͺॱ);
        LinearLayout linearLayout2 = (LinearLayout) view.findViewById(b.ˎˏ);
        this.ॱॱ = view.findViewById(b.ॱ);
        this.ॱॱ.setVisibility(8);
        linearLayout.setOnClickListener(this.ॱˊ);
        linearLayout2.setOnClickListener(this.ॱˊ);
        this.ॱ.setOnClickListener(this.ॱˊ);
        return this;
    }

    public void onClick(View view) {
        if (view.getId() == b.ͺॱ) {
            ˎ();
        } else if (view.getId() == b.ˎˏ) {
            ʼ();
        } else if (view.getId() == b.ˌ) {
            ʻ();
        }
    }

    private void ˎ() {
        if (this.ˏॱ == null) {
            bqx.ॱ("ForumRemindGameMsgCard", "section == null,jump to section failed");
            return;
        }
        cil.ˋ(this.ʼॱ, new a().ˊ(this.ˏॱ.ॱॱ()).ˋ());
        fjb ˎ = fho.ˏ().ˋ("Section").ˎ("section_detail_activity");
        ISectionDetailActivityProtocol iSectionDetailActivityProtocol = (ISectionDetailActivityProtocol) ˎ.ˊ();
        iSectionDetailActivityProtocol.setUri(this.ˏॱ.ॱॱ());
        iSectionDetailActivityProtocol.setDomainId(this.ᐝ);
        fiu.ˊ().ˏ(this.ʼॱ, ˎ);
    }

    private void ʼ() {
        if (TextUtils.isEmpty(this.ʽ)) {
            bqx.ॱ("ForumRemindGameMsgCard", "detailUrl == null,jump to msg detail failed");
            return;
        }
        cil.ˋ(this.ʼॱ, new a().ˊ(this.ʽ).ˋ());
        bwy.ˏ().ˎ(this.ʼॱ, this.ʽ, 0, this.ᐝ);
    }

    private void ʻ() {
        int i = 0;
        if (1 == this.ˊॱ) {
            i = 1;
        }
        ((bwx) fho.ˏ().ˋ("Operation").ॱ(bwx.class)).ˏ(this.ʼॱ, this.ˏॱ, i, this.ᐝ).ˏ(new fjq<Boolean>(this) {
            final /* synthetic */ ForumRemindGameMsgCard ˎ;

            public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                int i = 1;
                if (o_fjo_java_lang_Boolean.ˊ() && ((Boolean) o_fjo_java_lang_Boolean.ॱ()).booleanValue()) {
                    if (i == 0) {
                        this.ˎ.ˏॱ.ˊ(1);
                        this.ˎ.ˊॱ = 1;
                        this.ˎ.ˎ(1);
                    } else {
                        this.ˎ.ˏॱ.ˊ(0);
                        this.ˎ.ˊॱ = 0;
                        this.ˎ.ˎ(0);
                        evk.ˏ(String.format(Locale.ENGLISH, this.ˎ.ʼॱ.getResources().getString(j.ͺॱ), new Object[]{this.ˎ.ˏॱ.ˏ()}));
                    }
                    brd o_brd = brd.ॱ;
                    String ˎ = bqy.ˋ().ˎ();
                    int ˎ2 = bqy.ˋ().ˎ(this.ˎ.ʼॱ);
                    int ˊ = this.ˎ.ˏॱ.ˊ();
                    String str = "MESSAGE";
                    if (i != 0) {
                        i = 0;
                    }
                    o_brd.ˊ(ˎ, ˎ2, ˊ, str, i);
                }
            }
        });
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof ForumRemindGameMsgCardBean) {
            ForumRemindGameMsgCardBean forumRemindGameMsgCardBean = (ForumRemindGameMsgCardBean) cardBean;
            if (forumRemindGameMsgCardBean.ˋॱ()) {
                this.ॱॱ.setVisibility(0);
            } else {
                this.ॱॱ.setVisibility(8);
            }
            this.ᐝ = forumRemindGameMsgCardBean.ॱ();
            this.ˏॱ = forumRemindGameMsgCardBean.ͺ();
            if (this.ˏॱ != null) {
                this.ˎ.setText(this.ˏॱ.ˏ());
                eqx.ˏ(this.ˏ, this.ˏॱ.ॱ(), "app_default_icon");
                this.ˊॱ = this.ˏॱ.ᐝ();
            }
            ˎ(this.ˊॱ);
            PostTime ʼ = forumRemindGameMsgCardBean.ʼ();
            if (ʼ != null) {
                this.ˊ.setText(btc.ˏ(this.ʼॱ, ʼ));
            }
            this.ˋ.setText(forumRemindGameMsgCardBean.ˊ());
            this.ʼ.setText(forumRemindGameMsgCardBean.ʽ());
            this.ʽ = forumRemindGameMsgCardBean.ॱॱ();
            if (CollectCheck.isEmpty(forumRemindGameMsgCardBean.ᐝ()) || TextUtils.isEmpty((CharSequence) forumRemindGameMsgCardBean.ᐝ().get(0))) {
                bqx.ˊ("ForumRemindGameMsgCard", "img list is empty");
                this.ͺ.setVisibility(8);
                return;
            }
            if (this.ʻ == null) {
                this.ʻ = (ImageView) this.ͺ.inflate().findViewById(b.ˋˋ);
            }
            this.ͺ.setVisibility(0);
            int ॱ = azb.ॱ(this.ʼॱ) - ((this.ʼॱ.getResources().getDimensionPixelSize(o.bvj.d.ˎ) * 2) + this.ʼॱ.getResources().getDimensionPixelSize(o.bvj.d.ॱˊ));
            int i = (int) (((double) ॱ) / 1.7777777777777777d);
            LayoutParams layoutParams = this.ʻ.getLayoutParams();
            layoutParams.width = ॱ;
            layoutParams.height = i;
            this.ʻ.setLayoutParams(layoutParams);
            this.ʻ.setTag(forumRemindGameMsgCardBean);
            eqx.ˏ(this.ʻ, (String) forumRemindGameMsgCardBean.ᐝ().get(0), "image_default_icon");
        }
    }

    private void ˎ(int i) {
        if (i == 1) {
            this.ॱ.setText(j.ᐨ);
            this.ॱ.setTextColor(this.ʼॱ.getResources().getColor(bue.b.ˊ));
            return;
        }
        this.ॱ.setText(j.ᶥ);
        this.ॱ.setTextColor(this.ʼॱ.getResources().getColor(bvj.a.ʽ));
    }
}
